﻿// Browser sniff -- the following code does a very simple browser check and rates the 
  //     browser as either Internet Explorer on a Win32 platform or not, so that we 
  //     know to use the ActiveX model, or the plug-in Model.
  var sBrowser = navigator.userAgent;  
  if ((sBrowser.indexOf("IE") > -1) && (navigator.platform == "Win32"))
  {
    sBrowser = "IE";
  } 
  else 
  {
    sBrowser = "nonIE";
  }
  // end browser sniff

  function showClick() // This function is called by the btnShowControls button.
                       // It sets the ShowControls property of Media Player to true.
  {
    if (sBrowser == "IE") 
    {
        document.MediaPlayer1.ShowControls = true;
    } 
    else 
    {
        document.MediaPlayer1.SetShowControls(true);
    }
  }

  function hideClick() // This function is called by the btnHideControls button.
                       // It sets the ShowControls property of Media Player to false.
  {
    if (sBrowser == "IE") 
    {
        document.MediaPlayer1.ShowControls = false;
    } 
    else 
    {
        document.MediaPlayer1.SetShowControls(false);
    }
  }

  function muteClick() // This function is called by the "Mute" button.
                       // It toggles the state of the Mute property of the Media Player.
  {
    var bMuteState;
    if (sBrowser == "IE") 
    {
        bMuteState = document.MediaPlayer1.Mute;
    } 
    else 
    {
        bMuteState = document.MediaPlayer1.GetMute();
    }
    if (bMuteState == true) 
    {
        document.myButtons.btnMute.value="Mute";
        if (sBrowser == "IE") 
        {
            document.MediaPlayer1.Mute = false;
        } 
        else 
        {
            document.MediaPlayer1.SetMute(false);
        }
    } 
    else 
    {
        document.myButtons.btnMute.value="Un-Mute";
        if (sBrowser == "IE") 
        {
            document.MediaPlayer1.Mute = true;
        } 
        else 
        {
            document.MediaPlayer1.SetMute(true);
        }
    }
  }

